package com.four.project.controller;

import com.four.project.pojo.Course;
import com.four.project.pojo.Teacher;
import com.four.project.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author zyt
 * @create 2020/7/7 11:42
 */

@RestController

public class TeacherController {

    @Autowired
    TeacherService teacherService;


    //查询个人信息
    @RequestMapping("/mymessage")
    public Teacher selectMymessage(String name,String password){
        return teacherService.selectMymessage(name,password);
    }


    /**
     * @param id Teacher和Course中的公共列
     * @return
     */
    @RequestMapping("/count")
    public Integer courseCount(Integer id){
        Integer integer = teacherService.courseCount(id);
        System.out.println(integer);
        return integer;
    }

    //查询我的所有课程
    @RequestMapping(value = "/find")
    public List<Teacher> findAll(Integer id){
        return teacherService.fingdAllById(id);
    }

    //修改我的信息
    @RequestMapping("/updatemymessage")
    public Integer updateMyMessage(Teacher teacher){
        Integer integer = teacherService.updateMyMessage(teacher);
        System.out.println(integer);
        return integer;
    }

    //认证身份(给用户添加身份证)
    @RequestMapping("/addidentity")
    public Integer addIdentity(Teacher teacher){
        Integer integer = teacherService.addIdentity(teacher);
        System.out.println(integer);
        return integer;
    }
}
